package com.example.mobile2021606145zbq0407homework;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity8 extends AppCompatActivity {

    private TextView tvMainTitle7;
    private TextView tvMain72;
    private TextView tvMain73;
    private TextView tvZhengshu;
    private EditText edtSevenOne;
    private Button btn7;
    private TextView TVResult7,TVResult7_2,TVResult_3;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main8);
        initView();
        btn7.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String string = edtSevenOne.getText().toString();
                //打印长度
                TVResult7.setText(String.valueOf(string.length()+"位数"));
                int b = Integer.parseInt(string);
                //遍历正序
                TVResult7_2.setText(String.valueOf(b)+" ");
                //遍历倒序
                StringBuffer buffer = new StringBuffer(String.valueOf(b));
                TVResult_3.setText(buffer.reverse());
            }
        });
    }

    private void initView() {
        tvMainTitle7 = (TextView) findViewById(R.id.tv_main_title7);
        tvMain72 = (TextView) findViewById(R.id.tv_main_7_2);
        tvMain73 = (TextView) findViewById(R.id.tv_main_7_3);
        tvZhengshu = (TextView) findViewById(R.id.tv_zhengshu);
        edtSevenOne = (EditText) findViewById(R.id.edt_seven_one);
        btn7 = (Button) findViewById(R.id.btn_7);
        TVResult7 = (TextView) findViewById(R.id.TV_result_7_1);
        TVResult7_2 = (TextView)findViewById(R.id.TV_result_7_2);
        TVResult_3 = (TextView)findViewById(R.id.TV_result_7_3);

    }
}